package com.jiahe.blog.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jiahe.blog.entity.ArticleEntity;
import com.jiahe.blog.model.dto.ArticleBackDTO;
import com.jiahe.blog.model.dto.ArticleHomeDTO;
import com.jiahe.blog.model.vo.ConditionVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ArticleDao extends BaseMapper<ArticleEntity> {

    /**
     * 查询首页文章
     *
     * @param condition 条件
     * @return 首页文章集合
     */
    List<ArticleHomeDTO> listUserArticles(@Param("condition") ConditionVO condition);

    /**
     * 查询后台文章
     *
     * @param condition 条件
     * @return 后台文章集合
     */
    List<ArticleBackDTO> listUserArticleBacks(@Param("condition") ConditionVO condition);

    /**
     * 查询后台文章总量
     *
     * @param condition 条件
     * @return 文章总量
     */
    Integer countUserArticleBacks(@Param("condition") ConditionVO condition);
}
